home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c,comp.std.c
- Path: blackbush.xlink.net!slsv6bt!slsv6bt!kanze
- From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
- Subject: Re: Integral conversion e.t.c. (was: Re: Hungarian notation)
- In-Reply-To: seebs@solutions.solon.com's message of 27 Jan 1996 12:22:26 -0600
- Message-ID: <KANZE.96Jan29121956@slsvewt.lts.sel.alcatel.de>
- Sender: news@lts.sel.alcatel.de
- Organization: SEL
- References: <30C40F77.53B5@swsbbs.com> <SPENCER.96Jan22113215@zorgon.ERA.COM>
- <KANZE.96Jan26164833@gabi.gabi-soft.fr> <DLtABq.Fzu@mv.mv.com>
- <4edqh2$rvl@solutions.solon.com>
- Date: 29 Jan 1996 11:19:56 GMT
-
- In article <4edqh2$rvl@solutions.solon.com> seebs@solutions.solon.com
- (Peter Seebach) writes:
-
- |> In article <DLtABq.Fzu@mv.mv.com>, Michael Furman <ENGR@GSSI.MV.COM> wrote:
- |> [Re a rule forbidding extensions.]
- [And in particular, additional forms of main...]
-
- |> >My question was: is such rule exists?
-
- |> Sort of.
-
- |> There are two kinds of things called "legal" C. One is a strictly
- |> conforming program, which must be accepted by, and work on, *any*
- |> conforming C compiler. The other is merely a conforming
- |> program, which must be accepted by, and work on, *at least one*
- |> conforming compiler. The latter class is meaningless; FORTRAN is
- |> conforming C. (gcc with g77 compiles it. Technically, gcc is not
- |> quite conforming, but nothing is.)
-
- There is more to it than that. There are many programs (including
- most legal fortran programs) for which the compiler is required to
- issue a diagnostic (after which, it may go ahead and compile it as
- fortran, or cobol, or whatever).
-
- In the particular case which you cite, I do *not* believe that gcc
- will compile the program without a diagnostic if the program is in a
- file called a.c. More ever, the compiler documentation definitly
- states that only programs in files whose names end in .c will be
- compiled as C. (A legal restriction, as far as I can see.)
-
- I think the crux of Michael Furman's question lies therein. Does the
- standard require a diagnostic if the function main is not of one of
- the two types given?
-
- To tell the truth, I'm not sure what the answer is. The text
- concerning main is in the chapter describing the environment. It
- doesn't appear as a semantic restriction or anything. It simply
- states that on start-up, a function called main will be called, and
- that the implementation must support the following forms. It doesn't
- seem (to me, at least) to say anything about what other forms it might
- support, or what the implementation must do if given a fully other
- definition of main.
-
- Normally, I would expect (at the very least) a compiler to generate a
- warning or an error for a main that it did not support. In fact,
- however, my compiler (gcc) accepts the following definition without
- the slightest complaint, although I'd rather not think about what will
- happen when I access parameter d:
-
- int main( char a , int b , long c , double d )
-
- |> For purposes of the C newsgroups, discussion of what is/isn't legal
- |> is generally restricted to strictly conforming C.
-
- Yes and no. In comp.std.c, the discussion is exactly about what is
- legal according to the standard. In comp.lang.c (to which this
- article is also cross-posted), the discussion should generally be a
- bit more open.
-
- Thus, for example, in comp.std.c, a program with a variable named far
- is illegal, and that is it. In comp.lang.c (and I hope in its
- moderated variant), I would hope that someone would point out that,
- legal or not, it's going to get you into trouble.
- --
- James Kanze Tel.: (+33) 88 14 49 00 email: kanze@gabi-soft.fr
- GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
- Conseils, Θtudes et rΘalisations en logiciel orientΘ objet --
- -- A la recherche d'une activitΘ dans une region francophone
-
-